﻿using System;

namespace MyLibrary.ThreeLayer.DataAccess.Attributes
{
    /// <summary>
    /// 主键属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
    public class PrimaryKeyAttribute : Attribute
    {
        public readonly PrimaryKeyType _PrimaryKeyType;
        public readonly Type _KeyGeneratorType;

        public PrimaryKeyAttribute()
        {
            this._PrimaryKeyType = PrimaryKeyType.None;
        }

        public PrimaryKeyAttribute(PrimaryKeyType type)
        {
            this._PrimaryKeyType = type;
        }

        public PrimaryKeyAttribute(Type keyGen)
        {
            this._PrimaryKeyType = PrimaryKeyType.None;
            this._KeyGeneratorType = keyGen;
        }
    }
}
